const base = 'cbv.aux.point.trade';

/**
 * 获取积分列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function search({ pg, search }) {
  return RSocket.rs({
    route: `${base}.search`,
    args: {
      pg: { ...pg },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 获取积分列表数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function count({ search }) {
  return RSocket.rr({
    route: `${base}.search.count`,
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * 获取指定积分交易
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function get(id) {
  return RSocket.rr({
    route: `${base}.${id}.search`,
  });
}

/**
 * 创建积分交易
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function create(data) {
  return RSocket.rr({
    route: `${base}.create`,
    data: { ...data },
  });
}

/**
 * 更行积分交易
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function update(data) {
  return RSocket.rr({
    route: `${base}.update`,
    args: { ...data },
  });
}

/**
 * @description 获取司机群组
 * @param {*} search 参数
 * @returns array
 */
// eslint-disable-next-line no-shadow
export function getGroup({ search, pg }) {
  return RSocket.rs({
    route: 'cbv.aux.group.search',
    args: {
      search,
      pg,
    },
  });
}

/**
 * 查询用户列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function getMember(search) {
  return RSocket.rs({
    route: 'cbv.aux.member.search',
    args: {
      pg: {
        page: 0,
        size: 999,
        sort: ['crDate;desc'],
      },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 根据指定id查询群组
 * @returns
 */
export function getGroupId(id) {
  return RSocket.rr({
    route: `cbv.aux.group.${id}.search`,
  });
}

/**
 * 更新群组
 * @returns
 */
export function groupUpdate(data) {
  return RSocket.rr({
    route: 'cbv.aux.group.update',
    data,
  });
}

/**
 * 取消积分交易
 * @returns
 */
export function cancelTransaction(id) {
  return RSocket.rr({
    route: `${base}.cancel.${id}`,
  });
}
